<?php defined('RUN_KATANA') or die('Restricted access');
class ProductCat extends Object
{
	public $Title;
	public $TitleImport;
	public $Active;
	
	public function __toString()
	{
		$out  = self::getTitle();
		return $out;
	}
	
	public function getTitle() { return $this->Title;  }
	public function getTitleImport() { return $this->TitleImport;  }
	public function getActive() { return intval($this->Active); }
	
	public function setTitle($val) { $this->Title=$val;  }
	public function setTitleImport($val) { $this->TitleImport=$val;  }
	public function setActive($val) { $this->Active=intval($val); }
	
	public function update()
	{
		if((self::getId() > 0) && (self::getDataChanged()))
		{
			$sql  = 'UPDATE '.DB_PERFIX.'product_cats SET ';
			$sql .= '`title`="'.self::formatText(self::getTitle()).'", ';
			$sql .= '`title_import`="'.self::formatText(self::getTitleImport()).'" ';
			$sql .= ' WHERE id='.self::getId().' LIMIT 1;';
			mysql_query($sql);
		}
	}
}
?>